# swig interface file for wrapping "gimi.cpp" 
# 13.10.2008
# <tapio.taipalus@tkk.fi>

%module gimimessage

//for std::string
//%include stl.i
//%include std_string.i

%{
#include "gimiutils.h"
#include "gimimessage.h"
%}

namespace gimi
{

/**
 * \class GIMIMessage
 * Container class of arrived message for easy use.
 */
class GIMIMessage
{
  public:
    GIMIMessage();
    virtual ~GIMIMessage();

//    void setData(const char *sourceData,
//                 const int sourceDataLen);

    int getMajorTypeId() const;
    int getMinorTypeId() const;
    int getMessageId() const;
    int getSenderId() const;
    int getMessageFlags() const;
    int getDatalength() const;
    char* getData() const;
    bool isStatusMessage() const;
    
    /**
     * Empties this message. Deletes *data.
     */
    virtual void reset();

    /**
     * Moves given GIMIMessage to current, and invalidates the original.
     *
     * \param[in] msg Message to move to this message.
     */
    virtual void assign(GIMIMessage &msg);
    
    /**
     * Copies given GIMIMessage to current.
     */
    virtual void copy(GIMIMessage &msg);

    gim::time arrivalTime; ///< Contains time of arrival of a message

    bool statusMessage; ///< Tells if this is a statusmessage from hub, or
                          ///< just a normal message

    int majorTypeId; ///< Message type (aka. protocol magic number)
    int minorTypeId; ///< (device number identifier etc.)
    int messageId; ///< Id-number of message, 0 if not defined explicitly.
    int senderId; ///< Message sender
    int messageFlags; ///< Flags from message.
    int datalength; ///< Length of data in message.
    char *data; ///< Pointer to message data.

  private:
    // Prevents use of copy constructors
    GIMIMessage(const GIMIMessage& gimiMessage);
    const GIMIMessage& operator= (const GIMIMessage& right);
};

} // end namespace gimi


